home *** CD-ROM | disk | FTP | other *** search
/ PC Player 2004 May / pc player 2004-05.iso / Demos / FarCry / Data1.cab / _F0B9E2DA5F764499AF6F2BEA5B545AA5 < prev    next >
Encoding:
Text File  |  2004-01-06  |  7.0 KB  |  197 lines

  1. -- Colonel Behaviour script
  2. --
  3. --    Describes an individual that commands a party of varied size (2-6 not counting him). 
  4. --     Upon danger, he sends a portion of the party ahead to check out the area, while he falls back with the rest.
  5. --    Upon player seen, he commands his subordinates to take cover between himself and the threat (Getting into
  6. --    attack position). Once in the attack position, he coordinates the attack by issuing cover fire commands combined
  7. --    with attack target commands. The group converges to the threat to ultimately destroy it.
  8. --    If alive when group number falls down to 50% of initial number, he radios for reinforcements and joins the
  9. --    attack on the threat. If left alone, he will try to secretly sneak out of the danger area and retreat towards
  10. --    a "safe point"
  11. --
  12. --------------------------
  13.  
  14. AIBehaviour.Colonel = {
  15.     Name = "Colonel",
  16.     TeamMembersDead = 0,
  17.     Activated = 0,
  18.  
  19.     InPosition = 0,
  20.     GrenadeThrown = 0,
  21.  
  22.     Sounds = {
  23.         getdown = Sound:Load3DSound("Sounds/e3ai/ry_get_down.wav"),
  24.         move = Sound:Load3DSound("Sounds/e3ai/ry_move.wav"),
  25.         pullback = Sound:Load3DSound("Sounds/e3ai/ry_pull_back.wav"),
  26.         spreadout = Sound:Load3DSound("Sounds/e3ai/ry_spread_out.wav"),
  27.         grenade = Sound:Load3DSound("Sounds/e3ai/ry_gernade.wav"),
  28.     },
  29.  
  30.  
  31.     -- SYSTEM EVENTS            -----
  32.     ---------------------------------------------
  33.     OnSpawn = function(self,entity )
  34.         AI:CreateGoalPipe(entity:GetName().."walk");
  35. --        AI:PushGoal(entity.GetName().."walk","signal",1,1,"FollowMeBoys",SIGNALFILTER_SUPERGROUP);
  36. --        AI:PushGoal(entity.GetName().."walk","bodypos",0,0);
  37. --        AI:PushGoal(entity.GetName().."walk","form",0,"woodwalk");
  38. --        AI:PushGoal(entity.GetName().."walk","run",0,0);
  39.         AI:PushGoal(entity:GetName().."walk","locate",1,entity.Properties.pathname);
  40.         AI:PushGoal(entity:GetName().."walk","pathfind",1,"");
  41.         AI:PushGoal(entity:GetName().."walk","trace",1,0);
  42. --        AI:PushGoal(entity.GetName().."walk","signal",1,1,"ArrivedAtClearing",0);
  43.  
  44.     end,
  45.     ---------------------------------------------
  46.     OnActivate = function(self,entity )
  47.         entity:SelectPipe(0,entity:GetName().."walk");            
  48.     end,
  49.     ---------------------------------------------
  50.     OnNoTarget = function( self,entity )
  51.  
  52.     end,
  53.     ---------------------------------------------
  54.     OnPlayerSeen = function( self,entity )
  55.         if (entity.Behaviour.InPosition == 0) then
  56.             return
  57.         end
  58.  
  59.         if (entity.Behaviour.GrenadeThrown == 0) then    
  60.             entity:SelectPipe(0,"throwagrenate");
  61.             return
  62.         end
  63.  
  64.         entity:SelectPipe(0,"firesometime");
  65.     end,
  66.     ---------------------------------------------
  67.     OnEnemySeen = function(self,entity )
  68.  
  69.     end,
  70.     ---------------------------------------------
  71.     OnEnemyMemory = function(self,entity )
  72.         if (entity.Behaviour.InPosition == 0) then
  73.             return
  74.         end
  75.  
  76.         entity:SelectPipe(0,"wait&reload");
  77.     end,
  78.     ---------------------------------------------
  79.     OnDeadFriendSeen = function(self,entity )
  80.     end,
  81.     ---------------------------------------------
  82.     OnDeadEnemySeen = function(self,entity )
  83.     end,
  84.     ---------------------------------------------
  85.     OnInterestingSoundHeard = function(self,entity )
  86.  
  87.     end,
  88.     ---------------------------------------------
  89.     OnThreateningSoundHeard = function( self,entity )
  90.         if (entity.Behaviour.InPosition == 0) then
  91.             return
  92.         end
  93.  
  94.         entity:SelectPipe(0,"findlostenemy");
  95.     end,
  96.     ---------------------------------------------
  97.     OnGunfireHeard = function(self,entity )
  98.     end,
  99.     ---------------------------------------------
  100.     OnFootstepsHeard = function(self, entity )
  101.     end,
  102.     ---------------------------------------------
  103.     OnGranateSeen = function( self,entity )
  104.     end,
  105.     ---------------------------------------------
  106.     OnLongTimeNoTarget = function(self, entity )
  107.     end,
  108.     ---------------------------------------------
  109.     OnGroupMemberDied = function( self,entity )
  110.         entity.Behaviour.TeamMembersDead = entity.Behaviour.TeamMembersDead + 1;
  111.         if ( entity.Behaviour.TeamMembersDead == 1) then
  112.             entity:Say(entity.Behaviour.Sounds.pullback);
  113.             entity:SelectPipe(0,"retreattotunnel");
  114.         end
  115.     end,
  116.     ---------------------------------------------
  117.     OnReceivingDamage = function (self,entity, shooter)
  118.     end,
  119.  
  120.  
  121.  
  122.     -- CUSTOM
  123.     -------------------------------------------------
  124.     CallReinforcements = function(self,entity, sender)
  125.     --    AI:Signal(SIGNALFILTER_ANYONEINCOMM,1,"Reinforcements",entity.id);
  126.         entity:StartAnimation(0,"ssignal_sgetdown");
  127.     end,
  128.     ----------------------------------------------
  129. --    EveryonePRONE = function(self,entity, sender)
  130. --        entity.SelectPipe(0,"pronealerted");
  131. --    end,
  132.     -------------------------------------------------
  133.     PlayGetDownAnimation = function(self,entity, sender)
  134.         entity:Say(entity.Behaviour.Sounds.getdown);
  135.         entity:StartAnimation(0,"ssignal_sgetdown",0,0.5);
  136.     end,
  137.     -------------------------------------------------
  138.     ArrivedAtClearing = function( self,entity, sender )
  139.         entity:SelectPipe(0,"reformatclearing");
  140.     end,
  141.     -------------------------------------------------
  142.     StayAlertMyself = function( self,entity, sender )
  143.         entity:SelectPipe(0,"sendlarry");
  144.         entity:StartAnimation(0,"sidle_loop",0,0.5);
  145.     end,
  146.     -------------------------------------------------
  147.     PlayPointAnimation = function(self,entity, sender)
  148.         entity:Say(entity.Behaviour.Sounds.move);
  149.         entity:StartAnimation(0,"ssignal_sfocus",0,0.5);
  150.     end,
  151.     -------------------------------------------------
  152.     SaySomethingBeforeThrow = function(self,entity, sender)
  153.         entity:StartAnimation(0,"sgrenade");
  154.     end,
  155.     -------------------------------------------------
  156.     ActuallyThrow = function(self,entity, sender)
  157.         -- LAUNCH THE SMOKE GRENADE
  158.         local rocket = Server:SpawnEntity("SmokeRocket");
  159.         local pos = entity:GetPos();
  160.         pos.z = pos.z+2;
  161.         rocket:Launch(rocket,-1,entity,pos,entity:GetAngles(),{x=0.2,y=0.2,z=0.2});
  162.         ----------------------------
  163.         GRENADE_WAS_THROWN = 1;
  164.     end,
  165.     -------------------------------------------------
  166.     LarryGoCheck = function(self,entity, sender)
  167.         entity:SelectPipe(0,"pronealerted");
  168.     end,
  169.     -------------------------------------------------
  170.     StakeOutTunnelEntrance = function( self,entity, sender )
  171.         entity:Say(entity.Behaviour.Sounds.spreadout);
  172.         entity:SelectPipe(0,"hidesomewhere");
  173.     end,
  174.     --------------------------------------------
  175.     WaitForThePlayer = function( self,entity, sender )
  176.         entity:SelectPipe(0,"standingthere");
  177.         entity.Behaviour.InPosition = 1;
  178.     end,    
  179.     --------------------------------------------
  180.     GetBackToHidePlace = function( self,entity, sender )
  181.         entity:SelectPipe(0,"hidealways");
  182.     end,
  183.     --------------------------------------------
  184.     CheckEnemyPosition = function(self, entity, sender )
  185.         entity:SelectPipe(0,"findlostenemy");
  186.     end,    
  187.     --------------------------------------------
  188.     ReEvaluate = function( self,entity, sender )
  189.         entity.Behaviour.GrenadeThrown = 1;
  190.         entity:SelectPipe(0,"findlostenemy");
  191.     end,    
  192.     ----------------------------------------------
  193.     PlayThrowAnimation = function (self,entity, sender)
  194.         entity:Say(entity.Behaviour.Sounds.grenade);
  195.         entity:StartAnimation(0,"sgrenade");
  196.     end,
  197. }